package cn.felord.common.controller;


import cn.felord.common.bean.Rest;
import cn.felord.common.bean.RestBody;
import cn.felord.common.entity.SysUser;
import cn.felord.common.service.ISysUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 系统用户表 前端控制器
 * </p>
 *
 * @author dax
 * @since 2018-09-09
 */
@RestController
@RequestMapping("/sysUser")
public class SysUserController {
    @Resource
    private ISysUserService iSysUserService;

    @CrossOrigin
    @GetMapping("/list")
    public Rest list(@RequestParam(defaultValue = "1") long current, @RequestParam(defaultValue = "15") long size) {
        IPage<SysUser> page = new Page<>(current, size);
        QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
        IPage<SysUser> sysUserPage = iSysUserService.page(page, sysUserQueryWrapper);

        return RestBody.okData(sysUserPage);
    }


}
